{% extends "../../theme/base_zhu.html" %}
{% block base_top_header %}
<div class="container">
    <div style="padding-top: 80px"></div>
    <div class="row">

        <ul class="breadcrumb">
            <li><a href="/">首页</a></li>
            <li class="active">上传文件</li>
            {% if userinfo and( userinfo.role[1] >= '2') %}
            <li class="fr">
                <a href="/entity/" class="btn btn-primary btn-xs">查看文件列表</a>
            </li>
            {% end %}
        </ul>

        <div class="row">
            <div class="col-sm-12">
                <div class="panel panel-black">
                    <div class="panel-heading"> 上传文件
                    </div>
                    <div class="panel-body">
                        <form action="" enctype="multipart/form-data" method="post" class="form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">类型</label>

                                <div class="col-sm-4">
                                    <select name="kind" class="form-control" id="kind">
                                        <option value="1" onclick="hiddenXX()">图片</option>
                                        <option value="2" onclick="hiddenXX()">PDF,zip,doc,rar,ppt,7z,xlsx</option>
                                        <option value="3" onclick="hiddenXX()">Url</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group" id="entitypic">
                                <label class="col-sm-2 control-label"></label>

                                <div class="col-sm-4">
                                    <input name="file" type="file" accept=".jpg,.jpeg,.gif,.png,.tif,.bmp">
                                </div>
                            </div>
                            <div class="form-group" id="entityfile" hidden>
                                <label class="col-sm-2 control-label"></label>

                                <div class="col-sm-4">
                                    <input name="file" type="file" accept=".pdf,.doc,.docx,.zip,.rar,.ppt,.7z,.xlsx">
                                </div>
                            </div>
                            <div class="form-group" id="entitytext" hidden>
                                <label class="col-sm-2 control-label">Url</label>

                                <div class="col-sm-4">
                                    <input name="file1" type="text" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label" for="desc">说明</label>

                                <div class="col-sm-4">
                            <textarea name="desc" id="desc" class="form-control" rows="8">

                            </textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"></label>

                                <div class="col-sm-4">
                                    <input type="submit" value="{{ _('Submit') }}" class="btn btn-primary">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            function hiddenXX() {
                var objS = document.getElementById("kind");
                var value = objS.options[objS.selectedIndex].value;

                if (value == 1) {
                    $("#entitypic").show();
                    $("#entityfile").hide();
                    $("#entitytext").hide();
                }
                else if (value == 2) {
                    $("#entityfile").show();
                    $("#entitypic").hide();
                    $("#entitytext").hide();
                }
                else {
                    $("#entitytext").show();
                    $("#entityfile").hide();
                    $("#entitypic").hide();
                }
            }
        </script>
    </div>
</div>
{% end %}

